<%-- 
    Document   : list
    Created on : 6-dec-2009, 15:24:14
    Author     : Thomas Roelens
--%>

<%@include file="../../header.jsp" %>

<h1>Prescription  for ${patientname}</h1>

<c:choose>
    <c:when test="${empty prescription}">
        No prescription found.
    </c:when>
    <c:otherwise>
        <table>
            <tr>
                <td>
                    Medication
                </td>
                <td>
                    ${prescription.medication.name}
                </td>
            </tr>
            <tr>
                <td>
                    Standard dose
                </td>
                <td>
                    ${prescription.medication.stdDose} ${prescription.medication.unit}
                </td>
            </tr>
            <tr>
                <td>
                    Prescribed dose:
                </td>
                <td>
                    <c:if test="${prescription.dosageIsFixed}">
                        Fixed amount: ${prescription.dosageDosage} ${prescription.dosageUnit}
                    </c:if>
                    <c:if test="${!prescription.dosageIsFixed}">
                        Variable amount
                    </c:if>
                </td>
            </tr>
            <tr>
                <td>
                    Frequency (#hours interval):
                </td>
                <td>
                    ${prescription.frequency}  <span style="font-size:smaller;">(${24/prescription.frequency}/day)</span>
                </td>
            </tr>
            <tr>
                <td>
                    Start time:
                </td>
                <td>
                    <fmt:formatDate value="${prescription.startTime}" pattern="dd MMM yyyy HH:00" />
                </td>
            </tr>
            <tr>
                <td>
                    End time:
                </td>
                <td>
                    <fmt:formatDate value="${prescription.endTime}" pattern="dd MMM yyyy HH:00" />
                </td>
            </tr>
            <tr>
                <td>
                    Remarks:
                </td>
                <td>
                    ${prescription.remarks}
                </td>
            </tr>
        </table>

        <h2>Tasks:</h2>
        <c:if test="${empty tasks}">
            <div>No tasks.</div>
        </c:if>
        <c:if test="${!empty tasks}">
            <table class="data">
                <thead>
                    <tr>
                        <td>
                            Task time
                        </td>
                        <td>
                            Task status
                        </td>
                        <td>
                            Completion time
                        </td>
                    </tr>
                </thead>

                <c:forEach var="task" items="${tasks}" varStatus="index">
                    <tr>
                        <td>
                            <fmt:formatDate value="${task.taskTime}" pattern="dd MMM yyyy HH:mm" />
                        </td>
                        <td>
                            ${task.status.title}
                        </td>
                        <td>
                            <c:if test="${task.completionTime != null}">
                                <fmt:formatDate value="${task.completionTime}" pattern="dd MMM yyyy HH:mm" />
                            </c:if>
                        </td>
                    </tr>
                </c:forEach>
            </table>
        </c:if>
    </c:otherwise>
</c:choose>


<div class="back" style="padding-top: 10px;">
    <a href="javascript:history.back()">Back</a>
</div>


<%@include file="../../footer.jsp" %>
